/**
 * example页面的一些api
 */
import request from '@/config/axios'

// 为什么不用get？
export const pageExample = (queryWrapper) => {
  let realQeryWrapper = {}
  realQeryWrapper.style_category_id = queryWrapper.styleCategoryIdList
  realQeryWrapper.space_category_id = queryWrapper.spaceCategoryIdList
  realQeryWrapper.keyword = queryWrapper.keyword
  if (queryWrapper.pageSize) {
    realQeryWrapper.page_size = queryWrapper.pageSize
  }

  if (queryWrapper.pageNumber) {
    realQeryWrapper.page = queryWrapper.pageNumber
  }
  return request.post({
    url: '/api/onlyforone/cases/list',
    params: realQeryWrapper
  })
}

export const getExampleById = (id) =>
  request.get({
    url: `/api/onlyforone/cases/detail/${id}`
  })

  export const getUnionById = (id) =>
    request.get({
      url: `/api/onlyforone/businessPartner/info`,
      params: {
        id
      }
    })

export const switchStatus = (exampleId, status) =>
  request.post({
    url: `/api/onlyforone/caseCollection/status/${exampleId}`,
    params: {
      status
    }
  })

export const getSpaceCategoryList = () =>
  request.get({
    url: `/api/onlyforone/caseSpaceCategory/list`
  })

export const getStyleCategoryList = () =>
  request.get({
    url: `/api/onlyforone/caseStyleCategory/list`
  })
